/*
 * 工作流模块示例：公共发起页面公用脚本文件
 * 
 * author:liyh
 * day:2017-04-21
 */
function modal_start(processDefinitionKey, assignee, taskDefinitionKey){
	alert(processDefinitionKey + "_" + assignee + "_" + taskDefinitionKey);
    //alert("elec_apply apply selectAssignee"+$('#ghbh').val());
    $('#assigneeDz').val(assignee);
    $('#taskDefinitionKey').val(taskDefinitionKey);
    
    alert("processDefinitionKey="+processDefinitionKey);
    alert("assignee="+assignee);
    alert("taskDefinitionKey="+taskDefinitionKey);
    
    $.ajax({
		url:"../elecBusiness/startProcessTravel.action",
		data:$("#TravelForm").serialize(),
		dataType:"JSON",
		type:"post",
		success:function(data){
			if(data == '1'){
				alert('新增信息成功！');
				closeModal();
				$("#saveBtn").attr("disabled",true);
				//window.opener.location.href=window.opener.location.href;
				//window.opener.searchTable.draw(false);
				//window.close();
			}else if(data == '0'){
				alert("新增信息失败1！");
				closeModal();
			}
		},
		error:function(e){
			alert("新增信息失败2");
			closeModal();
		}
	})
/*	$.post("startProcess", {
		"assignee" : assignee,
		"taskDefinitionKey" : taskDefinitionKey,
		"processDefinitionKey" : processDefinitionKey
	}, function(data) {
		alert(data.sign);
		
		// 成功后回调模态窗口关闭方法
		closeModal();
	});*/
}

//待办公共页面点击选人按钮触发方法
function selectAssignee(flowLinkid){
    //alert("elec_apply apply selectAssignee"+$('#ghbh').val());
//	alert("业务侧示例，将公共页面“下环节处理人信息”处理完成，本次接受到的环节ID为：" + flowLinkid);
	var flowId =flowLinkid;
	var elecApplyId = $('#elec_id').val();
	$.ajax({
        url: '../flowCfgLinkController/showNextStaff',
        type: 'POST',
        dataType:"JSON",
        data: {flowId:flowId,elecApplyId:elecApplyId},
        success: function (data) {
        	$("#assignee").val(data.staffId);
        	$("#assigneeName").val(data.staffName);        	
        },
        error: function (jqXHR, textStatus, errorThrown) {
            alert('An error has occured!! :-(');
        }
    });
//	
//	$("#assignee").val(10001);
//	$("#assigneeName").val("示例：处理人");

}